﻿using UnityEngine;
using System.Collections;
using UnityEngine.UI;
using UnityEngine.EventSystems;
using System.Reflection;
public class drop : MonoBehaviour,IDropHandler,IPointerEnterHandler,IPointerExitHandler {
	public Image receiveiamge;


	public void OnDrop(PointerEventData eventdata)
	{
		Sprite srcp = getimage (eventdata);
		if (srcp != null)
			receiveiamge.overrideSprite = srcp;
	}
	public void OnPointerEnter(PointerEventData eventdata)
	{

	}
	public void OnPointerExit(PointerEventData eventdata)
	{

	}
	Sprite getimage(PointerEventData eventdata)
	{
		var originalObj = eventdata.pointerDrag;
		if (originalObj == null)
			return null;
		var srcimage = originalObj.GetComponent<Image> ();
		if (srcimage == null)
			return null;
		return srcimage.sprite;
	

	}


}
